<?php
error_reporting(0); 
include("include/os.php");
include("config/conn.php");
include("config/common.php");
$userid=$_COOKIE[uid];
include("include/limit_play.php");
$type="where userid='$userid'";
$neirong1=queryall(ubouser,$type);
if(empty($userid)||empty($neirong1)){
    echo "<script>location.href='/user/login.php'</script>";exit();
}
if ($userid)
{
$type="where userid='$userid'";
$neirong=queryall(ubouser,$type);
$user=$neirong[user];
$avatar=$neirong[avatar];
$cuid=$neirong[id];
$money = $neirong['money'];
$fx_uid_1 = $neirong['fx_uid_1'];
$fx_uid_2 = $neirong['fx_uid_2'];
$fx_uid_3 = $neirong['fx_uid_3'];
$fx_uid_4 = $neirong['fx_uid_4'];
$fx_uid_5 = $neirong['fx_uid_5'];
}
$sz="where id='1'";
$shezhi=queryall(se2wz,$sz);
$sk=$shezhi[sk];
$playid=$_GET["playid"];
$ly=$_GET["ly"];
$rfr=$_COOKIE[ulr];//来源;
$zt=$_GET[zt];
if($ly=="ubosk" || $ly=="up" || empty($ly)){
$type="where id='$playid'";
$neirong=queryall(se2nr,$type);
$type="where id='1'";
$play=queryall(ubozf,$type);
$shijian=$play[sktime];
$renqi=$neirong[cishu];
$favorite = $neirong[favorite];
$uid = $neirong[uid];
$division = $neirong[division];
$member = $neirong[member];
$pay_money = $neirong['price'];
$cishu=$neirong[cishu]+1;
$fenlei=$neirong[fenlei];
$contents = $neirong[contents];
$censor = $neirong[censor];
$url = $neirong[url];
$url_1 = $url;//按逗号分离字符串 
$url_2 = explode('|',$url_1); 
$array = $url_2;
$count = count($url_2);
$download = $neirong[download];
$download_1 = $download;//按逗号分离字符串 
$download_2 = explode('|',$download_1); 
$array_2 = $download_2;
$count_2 = count($download_2);
$type="cishu='$cishu' where id='$playid'";
upalldt(se2nr,$type);
}
$name=$neirong[name];
$name=str_replace("?","",$name); 
$val1 = getone("select id from se2nr WHERE id>".$playid." ORDER BY id asc LIMIT 1");
$val1 = $val1[id];
$val2 = getone("select id from se2nr WHERE id<".$playid." ORDER BY id desc LIMIT 1");
$val2 = $val2[id];
if($playid== null || empty($name)){ 
echo "<script>alert('抱歉，你访问的资源已经删除！');location.href='/';</script>";
exit;
}
if($censor>0 && empty($zt)){ 
echo "<script>alert('视频审核中！');location.href='/user/user_video_list.php';</script>";
exit;
}

if($money<=0||$pay_money>$money)
{
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>";
echo "<script>alert('财务金币不足，请先充值！');window.location.href='/user/user_service.php';</script>";
exit;
}else{
    $pid = $neirong[id];
    $addtime = time()+ 3600*12;
    $type=" where  uid='$cuid' and pid='$pid' and addtime<".$addtime;
    $info = dbquery(ubotj,$type);
    if(!$info){
        update_money($cuid,$pay_money,'购买视频',2,$pid);
        //返利
        if($fx_uid_1){
            update_money($fx_uid_1,$pay_money*0.1,'分销收入',1,$pid);
        }
        if($fx_uid_2){
            update_money($fx_uid_1,$pay_money*0.1,'分销收入',1,$pid);
        }
        if($fx_uid_3){
            update_money($fx_uid_1,$pay_money*0.1,'分销收入',1,$pid);
        }
        if($fx_uid_4){
            update_money($fx_uid_1,$pay_money*0.1,'分销收入',1,$pid);
        }
        if($fx_uid_5){
            update_money($fx_uid_1,$pay_money*0.1,'分销收入',1,$pid);
        }

    }
}
$i=rand(1,14);
if ($apache==1)
{$kz="html"; $link="play.html";}
else
{$kz="php"; }



?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title><?php echo $name;?></title>
<?php include_once('include/meta.php');?>
<SCRIPT language=javascript src="/js/jquery.min.js"></SCRIPT>
<SCRIPT language=javascript src="/app/layer/layer.js"></SCRIPT>
<script type="text/javascript" src="/js/manhuaHtmlArea.1.0.js"></script>
<link href="/css/manhuaHtmlArea.1.0.css" rel="stylesheet" type="text/css" />
<?php include_once('include/css.php'); ?> 
<script language="JavaScript" type="text/JavaScript"> 
$(function (){
	$("#bq").manhuaHtmlArea({
		Event : "click",
		Left : -38,
		Top : -312,			
		id : "content"
	});
});
$(document).ready(function()
{

    $("#tvlists a").click(function()
    {
        $("#tvlists a").removeClass("select");
        $(this).addClass("select");

    }); 
    $("#change ul li a").click(function(){
        if ($(this).parent().hasClass('tabactive')) {
            return false;
        } else {
            $(this).parent().addClass('tabactive').siblings().removeClass('tabactive');
            if ($(this).attr('class') == 'tab1') {
                $('#juji').show();
				$('#xiaxia').hide();
                $('#juqing').hide();
                $('#dashang').hide();
            }else if ($(this).attr('class') == 'tab2') {
                $('#juji').hide();
				$('#xiaxia').show();
                $('#juqing').hide();
                $('#dashang').hide();
            }else if ($(this).attr('class') == 'tab4') {
                $('#juji').hide();
				$('#xiaxia').hide();
                $('#juqing').hide();
                $('#dashang').show();
            }else {
				$('#juji').hide();
				$('#xiaxia').hide();
                $('#juqing').show();
                $('#dashang').hide();
            }
        }
    }); 
});
function jsname(dd)
{
document.getElementById('jishu').innerHTML='（'+dd+'）';
}
</script>
</head>
<body id="play">
<header id="header" class="ui-header ui-header-positive ui-border-b"><i class="ui-icon-return" id="return"    onclick='location.href="<?php echo $rfr;?>"'></i>
<h1 class="ui-nowrap ui-whitespace"><?php echo $name;?></h1>
</header>
<div class="container">
<div id="playerwrap" style="width: 100%; height: 214.669px;"></div>
<script type="text/javascript">
    document.getElementById('playerwrap').innerHTML = '<iframe id="baiduSpFrame" name="baiduSpFrame" border="0" vspace="0" hspace="0" marginwidth="0" marginheight="0"  frameborder="0" scrolling="no" width="100%" height="100%" src="/ckplayer/v1.php?id=<?php $jiami=$neirong[id];$jiami=($jiami*512)+12865379;$jiami=base64_encode($jiami); echo $jiami;?><?php if ($zt){echo "&zt=sh";} ?>"></iframe>';
</script>
<?php if ($count>=1){?>
<script language="javascript" src="/plus/api.php?id=101"></script>
<script language="javascript" src="/plus/api.php?id=102"></script>


</div> 
<?php }?>

<div style="display:none"><iframe id="msgubotj" name="msgubotj" width=0 height=0></iframe></div> 
<script language="javascript" src="/plus/api.php?id=1"></script>
<div id="commentList">
<h2><span><i></i>
</span>网友热评</h2>
<?php
$query = mysql_query("SELECT * FROM  ubopl where nrid='$playid' or nrid=0 order by rand() limit 10");
while($a = mysql_fetch_array($query)) {
$time=time();
$dqtime=intval($time);
$sctime=$a[addtime];
$sctime=intval($sctime);
$sytime=$dqtime-$sctime;
if ($sytime>0)
{
if ($sytime<60){
     $sctime=floor($sytime)."秒";}
	 elseif ($sytime<3600){
     $sctime=floor($sytime/60)."分钟";}
     elseif ($sytime<86400){
     $sctime=floor($sytime/3600)."小时";}
     else{$sctime=floor($sytime/86400)."天";}
 }
$shijian=$a[shijian];
?> 
<div class="comment" >
<div class="avatar"><img src="<?php echo $a[pic];?>"></div>
<div class="commentCnt">
<div class="username"><?php echo $a[name];?></div>
<div class="usermsg"><?php echo $a[neirong];?></div>
<div class="metainfo"><span>热评</span><?php if ($shijian==0){echo $sctime."前";}else{echo $shijian;}?></div>
</div>
</div>
<?php }?>  
</div>
<?php if($avatar){?>
<div id="comment"><form id="comment" name="comment" method="post" action="plus/comment.php" target="msgubotj"><div class="ui-left"><span><img src="/images/smail.png" id="bq" alt="选择表情" class="bq" /></span><span>表情</span></div><div class="plnr"><div class="left">
  <textarea name="content" rows="3" class="content" id="content"></textarea>
  <input type="hidden" name="id" value="<?php echo $playid;?>">
  <input name="type" type="hidden" value="1">
</div><div class="right"><input name="提交" type="submit" class="user_reg_but" value="发表评论" />
</div></div></form></div><?php }?>
</div>
<script type="text/javascript">
$(document).ready(function()
{
	var commentList=document.getElementById('commentList').innerHTML;
	$("#commentList").replaceContent(commentList);
});
function uboplay(id,ly){
window.<?php if($iseveryday<2){echo "msgubotj.";}?>location.href='<?php echo $link;?>?id='+id+'&ly='+ly+''; 
}
</script>
<?php include_once('include/nav1.php'); ?>
<!-- 提示付费窗口 -->
<div id="paybox" class="ui-dialog">
<div class="ui-dialog-cnt">
<a class="ui-icon-close-page" data-role="button"></a>
<div class="info">
<h4/>
<p class="ui-txt-red" style="margin:12px 0;">
您目前是普通会员仅能试看<?php echo $sk;?>分钟，升级VIP会员无限制哦！
</p>
</p>
</div>
<?php include_once('include/foot.php'); ?> 
</body>
</html>
